<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理员登录</title>
    <link rel="stylesheet" type="text/css" href="css/manager_login.css">
<!--    <script src="js/manager_login.js"></script>-->
    <script src="js/vue.js"></script>
    <script src="js/cdn.axios.js"></script>
</head>
<body>
<div id="root">
    <div class="login-container">
        <div class="left-container">
            <div class="title"><span>管理员登录</span></div>
            <div class="input-container">
                <input type="text" name="username" placeholder="管理员邮箱" v-model="email">
                <input type="password" name="password" placeholder="管理员密码" v-model="password">
            </div>

        </div>
        <div class="right-container">
            <div class="action-container">
                <span @click="login">登录</span>
            </div>
        </div>
    </div>
</div>
<script>
    const {createApp} = Vue;
    createApp({
        data() {
            return {
                email:"",
                password:"",
            }
        },
        methods:{
            login() {
                // console.log(this.username);
                axios({
                    method: "post",
                    url:"/admin/login",
                    contentType: 'application/json',
                    data:{

                        "email":this.email,
                        "passwd":this.password,
                    }
                }).then(function (res) {
                    if(res.data.code===200) {
                        console.log(res.data.code)
                        window.location.href='user.html';
                    } else {
                        alert("用户名或密码错误");
                    }
                })
            }
        }
    }).mount('#root')
</script>
</body>
</html>